import socket

client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

server_addr = ('172.1.128.64', 8000)  # 元祖
client_socket.connect(server_addr)

while True:
    send_msg = input('客户端>>')
    if send_msg == 'quit':
        client_socket.send(send_msg.encode('utf8'))
        break

    client_socket.send(send_msg.encode('utf8'))

    msg = client_socket.recv(1024).decode('utf8')

    print(f'来自服务器IP为:{server_addr[0]}，端口号为：{server_addr[1]}的消息：{msg}')

client_socket.close()
